package javabasics.netty.login.codec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import javabasics.netty.login.protocol.PacketCodeC;

import java.util.List;

/**
 * netty 提供的解码类
 *
 * @Author suxiaoxiao
 * @Date 2019/9/17 23:59
 * @Version 1.0
 */
public class PacketDecoder extends ByteToMessageDecoder {

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        out.add(PacketCodeC.INSTANCE.decode(in));
    }

}
